'use strict';
import request from './api';
//2021.5新增封装
export function gettingMethod(url, query,loadingValue) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
      url: baseURL,
      method: 'get',
      params: query,
      isLoading:loadingValue,
    })
}
export function postingMethod(url, query,loadingValue) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
      url: baseURL,
      method: 'post',
      data: query,
      isLoading:loadingValue,
    })
}
export function postingBlobMethod(url, query,loadingValue) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
      url: baseURL,
      method: 'post',
      data: query,
      responseType: 'blob',
      isLoading:loadingValue,
    })
}
export function postingMethodCancel(url, query,loadingValue,cancel) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
        url: baseURL,
        method: 'post',
        data: query,
		    isLoading:loadingValue,
        cancelToken : cancel
    })
}
export function uploadMethod(url, query) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
        url: baseURL,
        method: 'post',
        data: query,
		headers: {
			'Content-Type': 'multipart/form-data'
		}
    })
}
export function puttingMethod(url, query) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
        url: baseURL,
        method: 'put',
        data: query
    })
}
export function delMethod(url, ids) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
        url: baseURL,
        method: 'delete',
        params: ids
    })
}
export function deleteMethod(url, ids) {
    const baseURL = /^\/.*/.test(url) ? url : `/${url}` // 判断URL是否以/开头
    return request({
        url: baseURL,
        method: 'delete',
        data: ids
    })
}
export function downloadFile(url,file_path){
  return request({
    url:'/file/download/downFile?filePath='+file_path,
    method: 'get',
    responseType: 'blob'
  })
}
export function downloadFile1(file_path){
  return request({
    url:'/arrange/handDenoise/download?id='+file_path,
    method: 'get',
    responseType: 'blob'
  })
}
export function download(url,query){
  return request({
    url:url,
    method: 'get',
	  params: query,
    responseType: 'blob'
  })
}
export function downloadAssets(url,query){
  return request({
    url:url,
    method: 'post',
	  data: query,
    responseType: 'blob',
	  timeout:0
  })
}
export function downloadPdf(url,query){
  return request({
    url:url,
    method: 'post',
	  data: query,
    responseType: 'arraybuffer',
	  timeout:0
  })
}
